package com.wd.elec.controller.bussiness;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.wd.elec.domain.CnLine;
import com.wd.elec.service.ICnLineService;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wd.common.core.controller.BaseController;
import com.wd.common.core.domain.HttpResponse;
import com.wd.common.annotation.Log;
import com.wd.common.enums.BusinessType;
import com.wd.common.utils.poi.ExcelUtil;


/**
 * 【请填写功能名称】Controller
 * 
 * @author liumingkun
 * @date 2024-07-26
 */
@RestController
@RequestMapping("/visitor/line")
public class CnLineController extends BaseController
{
    @Resource
    private ICnLineService cnLineService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:list')")
    @GetMapping("/list")
    public HttpResponse list(CnLine cnLine)
    {
        startPage();
        List<CnLine> list = cnLineService.selectCnLineList(cnLine);
        return HttpResponse.successData(getDataTable(list));
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CnLine cnLine)
    {
        List<CnLine> list = cnLineService.selectCnLineList(cnLine);
        ExcelUtil<CnLine> util = new ExcelUtil<CnLine>(CnLine.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:query')")
    @GetMapping(value = "/{id}")
    public HttpResponse getInfo(@PathVariable("id") Long id)
    {
        return successData(cnLineService.selectCnLineById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public HttpResponse add(@RequestBody CnLine cnLine)
    {
        return getResult(cnLineService.insertCnLine(cnLine));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public HttpResponse edit(@RequestBody CnLine cnLine)
    {
        return getResult(cnLineService.updateCnLine(cnLine));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('visitor:line:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public HttpResponse remove(@PathVariable Long[] ids)
    {
        return getResult(cnLineService.deleteCnLineByIds(ids));
    }
}
